package com.quectel.core.module.scheduling.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 *
 * @author zhangheng
 * @email nolan.zhang@quectel.com
 * @date 2023/07/05 13:24
 */
@Data
@Schema
public class SchedulingWorkOvertimeConfigDto implements Serializable {

    /**
    * id
    */
    @Schema(description = "id")
    private Long id;

    /**
    * 租户id
    */
    @Schema(description = "租户id")
    private Long tenantId;

    /**
    * 小区
    */
    @Schema(description = "小区")
    private Long villageId;

    /**
    * 加班规则名称
    */
    @Schema(description = "加班规则名称")
    private String name;

    /**
    * 加班计算单位：1.天 2.小时 3.分钟
    */
    @Schema(description = "加班计算单位：1.天 2.小时 3.分钟")
    private Byte unit;

    /**
    * 取整类型：1.不取整 2.向上取整 3.向下取整
    */
    @Schema(description = "取整类型：1.不取整 2.向上取整 3.向下取整")
    private Byte roundingType;

    /**
    * 取整数
    */
    @Schema(description = "取整数")
    private BigDecimal roundingNum;

    /**
    * 工作日加班配置 结构见代码
    */
    @Schema(description = "工作日加班配置 结构见代码")
    private String workDayConfigJson;

    /**
    * 休息日加班配置 结构见代码
    */
    @Schema(description = "休息日加班配置 结构见代码")
    private String restDayConfigJson;

    /**
    * 节假日加班配置 结构见代码
    */
    @Schema(description = "节假日加班配置 结构见代码")
    private String holidayConfigJson;

    /**
    * 其他配置
    */
    @Schema(description = "其他配置")
    private String otherConfigJson;

    /**
    * 1启动0禁用
    */
    @Schema(description = "1启动0禁用")
    private Byte status;

    /**
    * 创建人
    */
    @Schema(description = "创建人")
    private String creator;

    /**
    * 创建时间
    */
    @Schema(description = "创建时间")
    private Date createTime;

    /**
    * 修改人
    */
    @Schema(description = "修改人")
    private String editor;

    /**
    * 修改时间
    */
    @Schema(description = "修改时间")
    private Date editTime;

    /************非数据库字段 start ************/
    @Schema(description = "小区名称")
    private String villageName;

    @Schema(description = "工作日加班设置json")
    private WorkDayConfig workDayConfig;

    @Schema(description = "休息日加班设置json")
    private RestDayConfig restDayConfig;

    @Schema(description = "节假日加班设置json")
    private HolidayDayConfig holidayConfig;

    @Schema(description = "更多设置json")
    private OtherConfig otherConfig;

    /************非数据库字段 end **************/
    @Data
    @Schema(description = "更多设置json")
    public static class OtherConfig implements Serializable {

        @Schema(description = "是否限制加班申请最晚时间 0不限制 1限制")
        private Byte overtimeApplyLimitStatus;

        @Schema(description = "最晚需在加班开始前xx天，提交申请")
        private Integer beforeOvertimeDay;

        @Schema(description = "最晚需在加班结束后xx天，提交申请")
        private Integer afterOvertimeDay;

        @Schema(description = "加班额度规则")
        private List<CycleRule> cycleObj;

    }

    @Data
    @Schema(description = "")
    public static class CycleRule implements Serializable {
        @Schema(description = "规则数组[] 工作日,节假日,休息日")
        private List<Byte> cycleLimits;

        @Schema(description = "周期 1每日 2每周 3每月")
        private Byte duration;

        @Schema(description = "限制加班时长")
        private Integer limitTime;
    }

    @Data
    @Schema(description = "节假日加班设置json")
    public static class HolidayDayConfig implements Serializable {

        @Schema(description = "是否允许休息日加班 0不允许 1允许")
        private Byte status;

        @Schema(description = "加班时长方式 1.按申请时长算 2.在申请时段内，按打卡时长算 3.无需申请，按打卡时长算")
        private Byte workOvertimeType;

//        @Schema(description = "上班前多少分钟算加班")
//        private Integer beforeWorkTime;
//
//        @Schema(description = "下班后多少分钟算加班")
//        private Integer afterWorkTime;

        @Schema(description = "最小加班时长 1限制 0不限制")
        private Byte minimumOvertimeType;

        @Schema(description = "当日加班时长最少xx分钟")
        private Integer todayLessTime;
//
//        @Schema(description = "1按休息时间扣除 0不扣除")
//        private Byte deductRestStatus;
//
//        @Schema(description = "扣除休息时间")
//        private String timeSection;

        @Schema(description = "结算方式类型 ")
        private Byte settlementType;

        @Schema(description = "结算比例")
        private Integer rate;

        @Schema(description = "抵扣成xx假期")
        private Byte deductionHolidayType;


    }

    @Data
    @Schema(description = "休息日加班设置")
    public static class RestDayConfig implements Serializable {

        @Schema(description = "是否允许休息日加班 0不允许 1允许")
        private Byte status;

        @Schema(description = "加班时长方式 1.按申请时长算 2.在申请时段内，按打卡时长算 3.无需申请，按打卡时长算")
        private Byte workOvertimeType;
//
//        @Schema(description = "上班前多少分钟算加班")
//        private Integer beforeWorkTime;

        @Schema(description = "下班后多少分钟算加班")
        private Integer afterWorkTime;

        @Schema(description = "最小加班时长 1限制 0不限制")
        private Byte minimumOvertimeType;

        @Schema(description = "当日加班时长最少xx分钟")
        private Integer todayLessTime;

//        @Schema(description = "1按休息时间扣除 0不扣除")
//        private Byte deductRestStatus;

//        @Schema(description = "扣除休息时间")
//        private String timeSection;

        @Schema(description = "结算方式类型 ")
        private Byte settlementType;

        @Schema(description = "结算比例")
        private Integer rate;

        @Schema(description = "抵扣成xx假期")
        private Byte deductionHolidayType;


    }

    @Data
    @Schema(description = "工作日加班设置")
    public static class WorkDayConfig implements Serializable {

        @Schema(description = "是否允许工作日加班 0不允许 1允许")
        private Byte status;

        @Schema(description = "加班时长方式 1.按申请时长算 2.在申请时段内，按打卡时长算 3.无需申请，按打卡时长算")
        private Byte workOvertimeType;

        @Schema(description = "允许加班时段 3.下班后")
        private Byte allowOvertimeType;

//        @Schema(description = "上班前多少分钟算加班")
//        private Integer beforeWorkTime;

        @Schema(description = "下班后多少分钟算加班")
        private Integer afterWorkTime;

        @Schema(description = "最小加班时长 1限制 0不限制")
        private Byte minimumOvertimeType;

//        @Schema(description = "上班前加班xx分钟")
//        private Integer beforeWorkLessTime;

//        @Schema(description = "班次内休息时段加班，最少xx分钟")
//        private Integer inRestLessTime;

//        @Schema(description = "下班后加班xx分钟")
//        private Integer afterWorkLessTime;
//
        @Schema(description = "当日加班时长最少xx分钟")
        private Integer todayLessTime;

//        @Schema(description = "1按休息时间扣除 0不扣除")
//        private Byte deductRestStatus;

//        @Schema(description = "扣除休息时间")
//        private String timeSection;

        @Schema(description = "结算方式类型 ")
        private Byte settlementType;

        @Schema(description = "结算比例")
        private Integer rate;

        @Schema(description = "抵扣成xx假期")
        private Byte deductionHolidayType;


    }
}
